﻿<%@ Page Language="C#" MasterPageFile="~/ControlPanel/CPanel.master" AutoEventWireup="True"
    Codebehind="Default.aspx.cs" Inherits="ControlPanel_Role_Default" Title="角色管理"
    StylesheetTheme="MainStyle" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div align="center">
        <br />
        <h3 style="text-align: center">
            角色管理
        </h3>
        <br />
        <atlas:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                添加角色：<asp:TextBox ID="txt_Roles" runat="server"></asp:TextBox>
                <asp:Button ID="btn_Add" runat="server" Text="添加" OnClick="btn_Add_Click" />
                <br />
                <br />
                <asp:GridView ID="gv_Roles" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    CellPadding="4" DataKeyNames="RoleName" DataSourceID="ObjectDataSourceRoles"
                    ForeColor="#333333" OnRowDataBound="gv_Roles_RowDataBound">
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <Columns>
                        <asp:BoundField DataField="RoleName" HeaderText="角色名称" ReadOnly="True" SortExpression="RoleName" />
                        <asp:BoundField DataField="NumberOfUsersInRole" HeaderText="用户数量" SortExpression="NumberOfUsersInRole" />
                        <asp:TemplateField ShowHeader="False" HeaderText="操作">
                            <ItemTemplate>
                                <asp:LinkButton ID="lnkBtn_Delete" runat="server" CausesValidation="False" CommandName="Delete"
                                    Text="删除"></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <RowStyle BackColor="#EFF3FB" />
                    <EditRowStyle BackColor="#2461BF" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
                <br />
            </ContentTemplate>
        </atlas:UpdatePanel>
        注：角色名称添加后，不可修改！！当角色中包含用户的时候，角色无法删除</div>
    <asp:ObjectDataSource ID="ObjectDataSourceRoles" runat="server" DeleteMethod="Delete"
        InsertMethod="Insert" SelectMethod="GetRoles" TypeName="MemberServerBLL.RoleDataObject">
        <DeleteParameters>
            <asp:Parameter Name="roleName" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="roleName" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <br />
</asp:Content>
